////////////////////////////////////////////////////////////////////////////////////////////////////
/// \file		SDevice\SDeviceK2400.h
/// 		
/// \author		Sylvain Martin
/// \version	1.0
/// \date		1/20/2011
///
/// \brief	Implements the SDevicek2400 class
/// 		
/// \section LICENSE
///
/// This program is free software; you can redistribute it and/or
/// modify it under the terms of the GNU General Public License as
/// published by the Free Software Foundation; either version 2 of
/// the License, or (at your option) any later version.
/// 
/// This program is distributed in the hope that it will be useful, but
/// WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
/// General Public License for more details at
/// http://www.gnu.org/copyleft/gpl.html
////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef SDEVICEK2400_H_
#define SDEVICEK2400_H_

#include "SDeviceDcGenerator.h"
#include <QObject>
#include <QScriptable>
#include <QScriptValue>
#include <QScriptEngine>



////////////////////////////////////////////////////////////////////////////////////////////////////
/// \class	SDeviceK2400
///
/// \brief	Provides control of the Keithley K2400 SourceMeter. 
///
/// \ingroup SDeviceMod
/// 
/// \author	Sylvain Martin
/// \date	1/20/2011
/// 		
/// \image html Keithley2400.jpg "Keithley 2400 SourceMeter"
/// 
/// Keithley 2400 is designed";
/// specifically for test applications that demand tightly
/// coupled sourcing and measurement.\n All SourceMeter models
/// provide precision voltage and current sourcing as well 
/// as measurement capabilities. Each SourceMeter instrument 
/// is both a highly stable DC power source and a true 
/// instrument-grade 5-1/2 digit multimeter. The power 
/// source characteristics include low noise, precision, 
/// and readback. The multimeter capabilities include high 
/// repeatability and low noise. The result is a compact, 
/// single-channel, DC parametric tester. In operation, 
/// these instruments can act as a voltage source, a 
/// current source, a voltage meter, a current meter, 
/// and an ohmmeter.	
/// 		
////////////////////////////////////////////////////////////////////////////////////////////////////

class  SDeviceK2400 : public SDeviceDcGenerator{
	Q_OBJECT;
	Q_ENUMS(SDeviceDcGenerator::MODE); //< on le declare pour les metaobjects


public :
	// specific at K2400
	SDeviceK2400(QObject *parent=0);
	SDeviceK2400(MODE mode, QObject *parent=0);	

	Q_INVOKABLE virtual QScriptValue qsReadVI(void);
	Q_INVOKABLE virtual QScriptValue qsReadIV(void);

    virtual QList<double> readVI(void);
	virtual QList<double> readIV(void);

	Q_INVOKABLE virtual void putLocalMode();

	// heritage of SDeviceDcGenerator
	Q_INVOKABLE virtual double current( );
	Q_INVOKABLE virtual void setCurrent(double current );

	Q_INVOKABLE virtual double voltage( );
	Q_INVOKABLE virtual void setVoltage(double voltage);

	Q_INVOKABLE virtual void setMode(const MODE mode);

	Q_INVOKABLE virtual void activate();
	Q_INVOKABLE virtual void deactivate();


	Q_INVOKABLE virtual void setVoltageRange(const double Imax);
	Q_INVOKABLE virtual void setCurrentRange(double Imax);

	Q_INVOKABLE virtual double currentRange(void);
	Q_INVOKABLE virtual double voltageRange(void);

	Q_INVOKABLE virtual void setCurrentCompliance(double Icomp);
	Q_INVOKABLE virtual void setVoltageCompliance(double Vcomp);

	Q_INVOKABLE virtual double currentCompliance();
	Q_INVOKABLE virtual double voltageCompliance();


	// heritage of SDeviceGpib


	// heritage of class SDeviceVirtual 
	Q_INVOKABLE virtual void init();	 
	Q_INVOKABLE virtual QString description()const;
	Q_INVOKABLE virtual bool available();


};

#endif //SDEVICEK2400_H_